FROM centos

# Maintainer
# --------------
MAINTAINER support  <support@bessystem.com>

# Environment variables required for this build
# ---------------------------------------------
ARG BES_DIST=BES-AppServer-Standard-10.0.0.2523.tar.gz
ARG JDK_DIST
ARG JDK_DIR

ENV BES_HOME /opt/bes/appserver
ENV TZ=Asia/Shanghai

# Basic support
#-----------------------------
RUN mkdir -p "$BES_HOME"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ>/etc/timezone
#COPY pkgs/*.rpm /opt/bes/
#RUN rpm -iv --replacepkgs /opt/bes/libX11-1.6.9-4.ky10.aarch64.rpm
#RUN rpm -iv --replacepkgs /opt/bes/freetype-2.10.2-2.ky10.aarch64.rpm --force
#RUN rpm -iv --replacepkgs /opt/bes/fontconfig-2.13.92-1.ky10.aarch64.rpm


# Setup bes
#----------------------------------------------
ADD ${BES_DIST} $BES_HOME
ADD ${JDK_DIST} /usr/java

ENV JAVA_HOME=/usr/java/$JDK_DIR
ENV PATH $JAVA_HOME/bin:$PATH

# License and Patch
ADD patch /opt/bes/patch
RUN if [ -d "/opt/bes/patch" ] && [ "$(ls -A /opt/bes/patch)" ]; then \ 
  $BES_HOME/bin/patch -path /opt/bes/patch; \
fi
#----------------------------------------------
#RUN rm -rf $BES_HOME/license/bes.lic.txt
EXPOSE 1900 6600 8080
WORKDIR $BES_HOME
ENTRYPOINT $BES_HOME/bin/iastool start --server --passport B#2008_2108#es --user admin --password B#2008_2108#es; tail -f $BES_HOME/logs/server.log
